//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Example #3--Temperature
// CS 151, 6 Apr 2009
// ECC, Spring 2009
// Niko Culevski
// This program gets input from the user, temperature
// in Fahrenheit, and displays temperature in Celsius
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import java.io.*;	// look in this library for definition of classes
                    // IOException, InputStreamReader, and BufferedReader
import java.text.*; // Needed for the DecimalFormat class

public class Temperature 		// convert Fahrenheit to  Centigrade
{
    public static void main (String args [ ]) throws IOException
	{
        double temperature;		//Fahrenheit temperature, declaration
	    String name, text;
	    InputStreamReader reader = new InputStreamReader(System.in);
	    BufferedReader input = new BufferedReader (reader);

	    System.out.print("Enter your name: ");  //Prompt for name
	    name = input.readLine();
	    System.out.print("Hello, " + name + "!");
	    System.out.print("\nPlease type the temperature (deg F): ");

	    text = input.readLine();    //Get temperature in Fahrenheit
	    temperature = new Double(text).doubleValue();
	    System.out.print("\n" + temperature);

        temperature = (5.0 * (temperature - 32.0)) / 9.0;
        //String myString = NumberFormat.getInstance().format(temperature);
        DecimalFormat fourDigits = new DecimalFormat("0.00000");

        //Display temperature in Celsius
        System.out.print(" deg F is " + fourDigits.format(temperature));
	    System.out.println(" deg C");
	}
}